<?php
class User_Model_User extends Zend_Db_Table_Abstract
{
	protected $_name = 'ipoo_user';
	protected $_primary = 'id';
	protected $db;
    
	public function listAllUser()
	{
		return $this->fetchall()->toArray();		
	}

	public function selectUser($id)
	{
		//$this->fetchRow($db->select()->where('username = ?', $id));
		$data = $this->fetchRow($this->select()->where('username = ?', $id));
		return $data;
	}
	
	public function insertUser($data)
	{
		$db = Zend_Db_Table::getDefaultAdapter();
		$db->insert('ipoo_user', $data);
		$last_insert_id = $db->lastInsertId('ipoo_user', 'id');
		return $last_insert_id;
	}
}